intoScoreValues(3,'3-105', -)Insert intoScoreValues(4,'3-105', -)Insert intoScoreValues(5,'3-105', -)Insert intoScoreValues(6,'3-105', -)--Business: To ensure the complete implementation of the entire process, all without problems, unified submission, once there is a problem, back to the origin. Like bank transfers.Begin Tran--z The start of the transaction--start writing the process statement--After the statement is finishedIf @ @ERROR >0Rollback tran--ROLLBACK TRANSACTIONElseCommit Tran--
This text has been reprinted online, and some SQL statements are suitable for use in application systems. Some "reports" have a heavier feeling, mainly to review the former.
This text has been reprinted online, and some SQL statements are suitable for use in application systems. Some "reports" are more likely to be used, mainly to review the former.
50 common SQL
50 common SQL statementsStudent (S #, Sname, Sage, Ssex) Student tableCourse (C #, Cname, T #) CurriculumSC (S #, C #, score) Orders tableTeacher (T #, Tname) Instructor tableProblem:1. query the student ID of all students whose score is higher than that of the "002" course;Select a. S # from (select s #, score from SC where C # = '001') a, (select s #, scoreFrom SC where C # = '002') BWhere a. score> B. sc
50 common SQL statements
Student (S #, Sname, Sage, Ssex) Student tableCourse (C #, Cname, T #) CurriculumSC (S #, C #, score) Orders tableTeacher (T #, Tname) Instructor table
Problem:1. query the student ID of all students whose score is higher than that of the "002" course;Select a. S # from (select s #, score from SC where C # = '001') a, (select s #, scoreFrom SC where C # = '002') BWhere a. score> B.
Tags: blog use problem div code HTML Management logTo manage the job training information, establish 3 tables:S (S#,SN,SD,SA) S#,sn,sd,sa respectively represents the student number, the student name, the unit, the Student Age C (C#,CN) C#,CN respectively represents the course number, the course name SC (s#,c#,g) S#,c#,g respectively represents the student number, the elective
();}2. Parameters of the array typeProgram codeSELECT * from T_blog where ID in#{item}Correspondence MapperProgram codePublic list3. Parameters of the Map typeProgram codeSELECT * from T_blog where title like "%" #{title} "%" and ID in#{item}The mapper should be such an interface:Program codePublic listthrough the above method, we can complete the general MyBatis dynamic SQL statement. The most common is if where foreach these, must focus on masterin
Tags: Oracle training Oracle Video Oracle Database tutorial Oracle Video Tutorial Oracle Video tutorial goals NBSP;NBSP;NBSP; Oracle video tutorial, wind Brother this set of Oracle Tutorial Training learning Oracle Sql*loader Concepts and usage and sql* Loader two cases, while the courseware with nearly 20 cases for everyone to practice their own. Applicable people It related practitioners, Oracle d
course (-59) Good (-80) Excellent (-100) Select Subject, (selectcountfromwhere and as failed, ( Select Count from where between and and as benign, (selectcountfromwhere and as excellent from Group by subject 13. Mathematics: Zhang San (50 points), John Doe (90 points), Harry (90 points), Zhao Liu (76 points) Declare @s varchar (1000) Set @s='select@s =@s+', '+name+' ('+convert (varchar(), score) +' points 'fromwhere subject=' mathematics ' Set
statement queries the number of employees in the department, where the ID and name of the employee are from the employee table, people_num from the Department table:The other Connection statement format is using the join on syntax, which is equivalent to the following statement:SELECT id,name,people_numFROM employee JOIN departmentON employee.in_dpt = department.dpt_nameORDER BY id;The result is the same as the statement just now.Second, practice1, using the method of connection query, the numb
Tags: SQL statementsDevelopment Course do practice Student Guide 051 les01 pptOracle often connects two tables, called a third paradigm, such as something with an ID characterThe following is the command for the SQL statementSELECT * from departments; Department tableSELECT * FROM Employees; Employee tableSelect Employee_id,rowid,rownum from Employeeswhere employ
After more than half a year of hard work, the book ASP. NET 3.5 + SQL Server website modular development full recording was finally successfully published by Tsinghua University Press.
The first time such books were published, there may inevitably be a lot of mistakes, but we hope that the majority of readers will not correct or criticize them. The readers of this book are: beginners and intermediate website developers, taking into account some basic
Tags: pt-killPercona Pt-kill Lite VersionAdd more slow SQL Mail alerts after killing is sentNote: The official original version of the default is killed by the SQL will not send mail, which will not be able to notify the development of timely, the troubleshooting problems caused confusion.Students who purchase a course can log inHttp://edu.51cto.com/
Tags: str utf8mb4 greater than ADE where name group drop coreUse an SQL statement to find out the names of students with more than 80 points in each course, with the following data table structure: The table SQL is built as follows: SETForeign_key_checks=0; -- ----------------------------
--Table structure for grade
-- ----------------------------
DROP TABLE IF
There is a student table with three columns in total. The first column is the student ID column, which stores the student ID of the Course Selection. You can repeat it to allow one student to select multiple courses.
The second column is the course column, that is, the name of the course selected.
The third column is the score column, that is, the score of the
An SQL statement is used to query the names of students whose scores are greater than 80 in each course. There are three tables: S, C, and SC S (Sno, Sname) C (Cno, Cname) SC (Sno, Cno, grade) -------------------------------------------------- problem: use an SQL statement to query the names of students whose scores are greater than 80 in each
('John Doe','Mathematics',' -'); - INSERT into' Grade 'VALUES('Harry','language','Bayi'); + INSERT into' Grade 'VALUES('Harry','Mathematics',' -'); A INSERT into' Grade 'VALUES('Harry','English',' -'); at SETForeign_key_checks=1;View CodeCheck the names of students who have more than 80 points for each course:1 Select distinct from where not inch (Selectdistinctfromwhere score);View CodeThere is also a simple notation:1 Select from Group by ha
In SQL Sever 2008, if you need to query the top 3 of each course, the implementation is as follows:Existing score table (result), column (Studentno, subjectno account number, Studentresult student score)Method One:SELECT distinct b.* Fromresult as RCross APPLY (SELECT TOP (3) *from Result WHERE r.subjectno= subjectno ORDER by Studentresult DESC) as BOrder by Subjectno, Studentresult descCross apply () use t
Label:Name Kecheng FenshuZhang San language 81Zhang San Mathematics 75John Doe Language 76John Doe Mathematics 90Harry Language 81Harry Mathematics 100Harry English 90 Method One: ideas: If you can get a table, by the student's name, language scores, math scores, English scores of the table, the rest is in the where conditions to filter and can get the desired results. specific measures: through the self-linking method, with "name" as the connection condition, since the connection three time
the cache are output to a file;Spool off means that the cache is closed and the file is saved on its own initiative; [Email protected] ~]$ Sqlplus/as SYSDBA Sql*plus:release 10.2.0.1.0-production on Wed June 18 13:52:25 2014 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-productionWith the partitioning, OLAP and Data Mining options [Email Protected]>spool/home/oracl
); insert INTO Employee (Id,name) Span class= "Hljs-keyword" >values (03, ' Rose '); You've noticed that some data needs to be enclosed in single quotes, such as the names of Tom, Jack, and Rose, because their data types are char type. In addition, Varchar,text,date,time,enum and other types of data also require single-quote decoration, while int,float,double and so on are not required.The first statement is a bit more than the second: (Id,name,phone) This parenthesis is the data to be added
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.